Skip to content

Glass SDK API Reference

This page organizes the public glasses-side glass3.open.sdk APIs for integration, capability lookup, and troubleshooting. Start with Quick Start to add the SDK dependency, then use the capability sections below to find the relevant interfaces.

API Category Overview

CategoryWhat to look for
Integration and initializationSDK binding, client registration, initialization status
GlassSdk service entry pointsGetting capability services through GlassSdk
Common information interfacesUser information, companion app information, glasses-side configuration changes
Offline voice command interfacesOffline command word configuration and compatibility methods
Voice and AIAI chat and ASR speech-to-text
Media capabilitiesAudio/video preview, photo/video capture, media state listeners
Messaging and file transferMessage and file exchange between phone and glasses
File system capabilitiesFile upload, file status, upload callbacks
Visual recognitionFace, license plate, person/vehicle recognition capabilities
Connectivity and peripheralsClassic Bluetooth and Bluetooth ring capabilities
Device and system capabilitiesDevice state, app visibility, battery, and system events

1 Integration and Initialization

kotlin
fun initSdk() {
        // Return directly if the SDK has already been initialized
        if (GlassSdk.isReady()) {
            Log.d(TAG, "SDK has already been initialized")
            return
        }
        GlassSdk.bindSecurityService(Utils.getApp(), object : IServiceConnectionCallback {
            override fun onServiceConnected() {
                // The clientId on the glasses side must be the same as the clientId registered on the phone side,
                // so the phone side knows which glasses-side application should receive the data
                GlassSdk.registerClient("GlassSample", mClientMessageCallback)
            }

            override fun onServiceDisconnected() {
                Log.i(TAG, "onServiceDisconnected: ")
            }

            override fun onBindingDied() {
                Log.i(TAG, "onBindingDied: ")               
            }
        })
    }

2 GlassSdk Service Entry Points and Common Capabilities

GlassSdk is the unified entry point for the glasses-side SDK. In a typical integration, bind the system service and register the client first, then call getGlassXxxService() to obtain the capability service you need.

2.1 Common Entry Methods

MethodDescription
bindSecurityService(context, callback)Bind the glasses-side system service. Register the client and obtain capability services after the binding succeeds.
registerClient(clientId, callback)Register the glasses-side application. The clientId must match the phone-side client ID.
isReady()Check whether the SDK service is bound.
release()Release the SDK connection and internal resources, usually when the app exits or no longer uses the SDK.

Use getGlassXxxService() to obtain capability services from GlassSdk. Service objects may be null, so check GlassSdk.isReady() first and handle nullable return values.

kotlin
if (!GlassSdk.isReady()) {
    // Bind the service and register the client first
    return
}

val mediaService = GlassSdk.getGlassMediaService()
val messageService = GlassSdk.getGlassMessageService()

2.2 Capability Service Entry Points

MethodReturned serviceDescription
getClassicBluetoothService()IBTServiceClassic Bluetooth capability.
getP2PGoService()IWifiP2PGoServiceWi-Fi P2P connectivity capability.
getGlassMessageService()IMessageServerMessaging capability.
getGlassCommonService()ICommonInfoServerCommon information capability.
getGlassMediaService()IMediaServerMedia preview, photo capture, and video recording capabilities.
getGlassOfflineFeatureRecService()IOfflineFeatureRecServiceOffline feature recognition capability.
getGlassOfflineRecService()IOfflineRecServerOffline recognition capability.
getGlassOnlineRecService()IOnlineRecServiceOnline person/vehicle recognition capability.
getGlassCollectService()ICollectServiceImage collection capability.
getGlassTrackService()ITrackServicePerson/vehicle detection and tracking capability.
getGlassDeviceService()IDeviceServiceDevice and system capability.
getGlassBluetoothRingService()IBluetoothRingServiceBluetooth ring capability.
getGlassNotificationService()INotificationServiceNotification capability.
getGlassAiChatService()IAiChatServiceAI chat capability.
getGlassFileSystemService()IFileSystemServiceFile system capability.
getGlassTranslateService()ITranslateServiceTranslation capability.
getGlassTtsService()ITtsServiceOnline TTS capability.
getGlassOfflineTtsService()IOfflineTtsServiceOffline TTS capability.
getGlassAsrService()IAsrServiceASR speech-to-text capability.
getGlassOfflineCmdService()IOfflineCmdServiceOffline voice command capability.
getGlassIdentificationService()IIdentificationServiceIdentification capability.

2.3 Common Information Interfaces

ICommonInfoServer is returned by GlassSdk.getGlassCommonService(). Use it to read user information, companion app information, and register common information callbacks. ICommonInfoListener is the corresponding listener for user information, companion app information, and glasses-side configuration changes.

ICommonInfoServer: Common Information Service

java
interface ICommonInfoServer {
    /**
     * Get user information
     * @return UserInfo
     */
    UserInfo getUserInfo();

    /**
     * Get companion app information
     * @return CompanionAppInfo
     */
    CompanionAppInfo getCompanionAppInfo();

    /**
     * Register listener
     * @param listener
     */
    void setCommonInfoListener(ICommonInfoListener listener);

    /**
     * Unregister listener
     * @param listener
     */
    void removeCommonInfoListener(ICommonInfoListener listener);

}

ICommonInfoListener: Common Information Callback

java
interface ICommonInfoListener {
    /**
     * Update user information
     * @param info
     */
   void onUserInfo(in UserInfo info);

    /**
     * Update companion app information
     * @param info
     */
   void onCompanionAppInfo(in CompanionAppInfo info);

   /**
    * Configuration information on the glasses side
    */
   void onConfig(in String config);
}

2.4 Offline Voice Command Interfaces

IOfflineCmdService is returned by GlassSdk.getGlassOfflineCmdService(). Use it to initialize, add, remove, and clear offline voice command words.

Compatibility Methods

MethodDescription
setOfflineCmdLanguage(language)Set the offline command language, such as ZH_CN or EN_US.
setOfflineCmdWords(language, voiceActions)Override offline command words by language.
clearOfflineCmdWords(language)Clear offline command words for a specified language.

IOfflineCmdService: Offline Voice Command Service

kotlin
interface IOfflineCmdService {
         /**
          * Initialize
          * */
         void init();

          /**
          * Restore the previously configured command words
          * */
         void restore();

          /**
          * Add command words
          *@Param VoiceAction Command word
          * */
         void add(in VoiceAction voiceAction);

          /**
           * Add command words
           *@Param voiceActions A group of command words
           * */
         void addAll(in List<VoiceAction> voiceActions);

          /**
           * Remove command words
           *@Param VoiceAction Command word
           * */
         void remove(in VoiceAction voiceAction);

           /**
            * Remove all command words
            * */
         void removeAll();

         /**
          * Release
           * */
         void release();

         /**
          * Get the current offline command language (ZH_CN / EN_US)
          */
         String getLanguage();

         /**
          * Switch the offline command language (ZH_CN / EN_US)
          */
         void setLanguage(String language);

         /**
          * Replace command words in batches by language (does not affect caches for other languages)
          */
         void setWords(String language, in List<VoiceAction> voiceActions);

         /**
          * Clear command words for a specified language
          */
         void clearWords(String language);

         /**
          * Start voice recording
          */
         void startRecord();

         /**
          * Stop voice recording
          */
         void stopRecord();

}

3 Voice and AI

IAiChatService: AI Chat Service

java
interface IAiChatService {

        /**
         * Start AI chat
         * @param isCameraOpen Whether the camera is currently enabled
         */
        void startAiChat(boolean isCameraOpen );

        /**
         * End AI chat
         */
        void endAiChat();

        /**
         * AI chat
         * @param question AI chat question
         * @param listener Callback for receiving the answer
         */
        void toAiChat(String question, AiChatListener listener);


         /**
         * AI chat with intent recognition
         * @param question AI chat question
         * @param intent Intent
         * @param intentJson Intent JSON
         * @param listener Callback for receiving the answer
         */
        void toAiChatWithIntent(String question, int intent, String intentJson, AiChatListener listener);


         /**
          * Inspection
          * @param question
          * @param listener
          */
        void toInspectChat(String question, AiChatListener listener);

         /**
          * Perform AI chat with a Base64 image
          * @param question Question text
          * @param filePath Base64-encoded image
          * @param listener AI chat listener
          */
        void toAiCode( String code,  AiChatListener listener);


        void removeAIChatListener();

}

AiChatListener

java
interface AiChatListener {



        /**
         * AI chat answer
         * @param answer Streaming answer
         * @param isFinish Answer termination flag
         */
   void onAiChatAnswer(String answer,boolean isFinish,String contentType,String sessionId);



       /**
        * Error callback for AI chat
        * @param code Error code
        * @param message Error message
       */
       void onError( int code , String message);


    void onAiTakePhoto(String filePath);

    void onContinuousModeUpdate( boolean continuousMode,  long timeout,  boolean keepSessionActive);


}

4 Media Capabilities

IMediaServer

kotlin
// CameraSize already implements Parcelable in Java/Kotlin
parcelable CameraSize;

interface IMediaServer {
    /**
     * Start recording
     * @param callback Recording callback
     * @param recordConfig Recording parameter settings
     */
    void startRecord(VideoCallback callback, in RecordConfig recordConfig);

    /**
     * Stop recording
     */
    void stopRecord();

    /**
     * Take a photo, which triggers the [PhotoFileCallback] callback with the captured file
     */
    void  takePhoto(int photoResolution,String path);

    /**
     * Add photo file callback
     * @param expectedResolution (Resolution)
     * @param photoFileCallback
     */
    void addPhotoCallback(PhotoFileCallback photoFileCallback);

    /**
     * Remove camera frame NV21 data callback
      */
    void removePhotoCallback(PhotoFileCallback photoFileCallback);

    /**
     * @return Maximum camera zoom level
     */
    int getMaxZoomLevel();

    int getZoomLevel();

    /**
     * Zoom camera
     * @param level Zoom level
     */
    void zoomCamera(int level);

    /**
     * Start audio recording
     * @param callback Audio callback
     */
    void startAudioRecord(AudioCallback callback);

    /**
     * Stop audio recording
     * @param callback Audio callback
     */
    void stopAudioRecord(AudioCallback callback);

   /**
     * Register media service status listener
     * @param listener
     */
    void setMediaStateLister(IMediaStateLister listener);

    /**
      * Unregister media service status listener
      * @param listener
      */
    void removeMediaStateLister(IMediaStateLister listener);


      void removeAllPhotoCallback();

    /**
     * Start cross-process Surface sharing (renders only camera frames to the Surface, without NV21 data)
     * @param surface Surface created by the client to receive camera frames
     * @param callback Lifecycle callback
     */
    void startCameraShare(in Surface surface, ICameraSurfaceCallback callback);

    /**
     * Stop cross-process Surface sharing
     * @param callback Previously registered callback
     */
    void stopCameraShare(ICameraSurfaceCallback callback);

    /**
     * Start NV21 data export (share frame data through SharedMemory double buffering)
     * @param callback Callback interface that receives frame data through onNv21FrameAvailable
     * @param enableMix Whether to enable overlay mode (camera + screen overlay),
     *                  false: Export pure camera NV21 data
     *                  true:  Export NV21 data after overlaying camera with screen content
     */
    void startCameraNv21Export(ICameraShareCallback callback, boolean enableMix);

    /**
     * Stop NV21 data export
     * @param callback Previously registered callback
     */
    void stopCameraNv21Export(ICameraShareCallback callback);

    /**
     * Close camera
     * @param callback Callback interface: true indicates the camera was closed successfully, false indicates the camera was not closed
     */
    void closeCamera(ICameraCloseCallback callback);

    /**
     * Start NV21 export (configurable resolution, frame rate, and stabilization)
     * @param callback Callback interface that receives frame data through onNv21FrameAvailable
     * @param enableMix Whether to enable AR Mix mode (camera + screen overlay)
     * @param config Configuration items, consistent with CameraShareConfig
     */
    void startCameraNv21ExportWithConfig(ICameraShareCallback callback, boolean enableMix, in CameraShareConfig config);

    /**
     * Start cross-process Surface sharing (configurable version)
     * @param surface Surface created by the client to receive camera frames
     * @param callback Lifecycle callback
     * @param enableMix Whether to enable AR Mix mode (camera + screen overlay)
     * @param config Configuration items, consistent with CameraShareConfig
     */
    void startCameraShareWithConfig(in Surface surface, ICameraSurfaceCallback callback, boolean enableMix, in CameraShareConfig config);

    /**
     * Get the list of preview resolutions supported by the Camera API
     * @return Supported resolution list (note: because the camera has rotation, the width and height of the camera raw resolution returned here are swapped compared with the resolution to be set in CameraShareConfig)
     */
    List<CameraSize> getSupportedPreviewSizes();
}

IMediaStateLister

java
interface IMediaStateLister {

    void onCameraResolutionChange(int width, int height);

    void onCameraError(int code,String errorMsg);
}

ICameraShareCallback

java
interface ICameraShareCallback {

    /**
     * Camera opened, with resolution and NV21 double-buffered SharedMemory provided
     * @param width Camera width
     * @param height Camera height
     * @param nv21Buffer0 NV21 double buffer 0
     * @param nv21Buffer1 NV21 double buffer 1
     */
    void onCameraOpened(int width, int height, in SharedMemory nv21Buffer0, in SharedMemory nv21Buffer1);

    /**
     * A new NV21 frame has been written to the specified buffer
     * @param bufferIndex Buffer index (0 or 1)
     * @param width Frame width
     * @param height Frame height
     * @param timestamp Frame timestamp (milliseconds)
     */
    void onNv21FrameAvailable(int bufferIndex, int width, int height, long timestamp);

    /**
     * Camera closed
     */
    void onCameraClosed();

    /**
     * An error occurred
     * @param code Error code
     * @param msg Error message
     */
    void onError(int code, String msg);

    /**
     * Unique callback identifier
     */
    String getCallbackId();

    /**
     * A new NV21 frame has been written to the specified buffer (asynchronous version, better performance)
     * @param bufferIndex Buffer index (0 or 1)
     * @param width Frame width
     * @param height Frame height
     * @param timestamp Frame timestamp (milliseconds)
     */
    oneway void onNv21FrameAvailableAsync(int bufferIndex, int width, int height, long timestamp);

    void onNv21ExportResolutionChanged(int width, int height, in SharedMemory nv21Buffer0, in SharedMemory nv21Buffer1, int appliedPreviewFps);

    void onNv21ExportRuntimeParamsChanged(int appliedPreviewFps, boolean videoStabilizationEnabled);

    /**
     * Zoom level changed
     * @param zoomLevel Current zoom level (integer)
     */
    void onZoomLevelChanged(int zoomLevel);
}

ICameraSurfaceCallback

java
/**
 * Lightweight callback for cross-process Surface sharing (lifecycle only, no NV21 data)
 */
interface ICameraSurfaceCallback {

    /**
     * Camera opened
     * @param width Camera width
     * @param height Camera height
     */
    void onCameraOpened(int width, int height);

    /**
     * Camera closed
     */
    void onCameraClosed();

    /**
     * An error occurred
     * @param code Error code
     * @param msg Error message
     */
    void onError(int code, String msg);

    /**
     * Unique callback identifier
     */
    String getCallbackId();

    /**
     * Surface sharing configuration changed (resolution, frame rate, stabilization, etc.)
     * Triggered when configuration is updated through startCameraShareWithConfig to avoid restarting the camera
     * @param width New width
     * @param height New height
     * @param appliedPreviewFps Negotiated frame rate
     * @param videoStabilizationEnabled Whether stabilization is enabled
     */
    void onSurfaceShareConfigChanged(int width, int height, int appliedPreviewFps, boolean videoStabilizationEnabled);

    /**
     * Zoom level changed
     * @param zoomLevel Current zoom level (integer)
     */
    void onZoomLevelChanged(int zoomLevel);
}

PhotoFileCallback

java
interface PhotoFileCallback {
   void onTakePhoto(String path);

    /**
     * Unified unique callback identifier method (implemented by the base class)
     */
    String getCallbackId();

    void onTakePhotoV2(String path, int width, int height);
}

VideoCallback

java
interface VideoCallback {

    void onStart();

    void onError();

    void onFinish();

    void onNewFile(long startTime, long endTime, String path, boolean isLast);

    void onErrorWithDetail(int code, String errorMsg);
}

5 Messaging and File Transfer

IMessageServer: Messaging Service

kotlin
interface IMessageServer {
    /**
     * Register message listener
     *  @param listener
     */
    void setMessageListener(IMessageListener listener);

    /**
     * Unregister message listener
     *  @param listener
     */
    void removeMessageListener(IMessageListener listener);

    /**
     * Send a text message through P2P (sent by default to the phone-side app corresponding to the first ClientId)
     * @param message
     */
    void sendTextMessageByP2P(String message);

    /**
     * Send a text message through P2P to the specified clientId app on the phone side
     * @param message
     * @param clientId
     */
    void sendTextMessageByP2PWithClient(String message, String clientId);

    /**
     * Send a text message through classic Bluetooth (sent by default to the phone-side app corresponding to the first ClientId)
     * @param message
     */
    void sendTextMessageByClassicBT(String message);

    /**
     * Send a text message through classic Bluetooth to the specified clientId app on the phone side
     * @param message
     * @param clientId
     */
    void sendTextMessageByClassicBTWithClient(String message, String clientId);

    /**
     * Start sending audio stream data (PCM)
     */
    void sendAudioStreamData();

    /**
     *  Stop sending audio stream data
     */
    void stopAudioStreamData();

    /**
     * Start sending H.264 video stream data
     */
    void sendVideoStreamData();

    /**
     * Stop sending H.264 video stream data
     */
    void stopVideoStreamData();

    /**
     * Send binary stream data
     * @param tag
     * @param data
     * @param clientId
     * @param callback
     */
    void sendStreamData(String tag,in byte[] data, String clientId, IResultCallback callback);

    /**
     * Get the P2P file sending manager
     * @return IGlassFileOperate
     */
    IGlassFileOperate getGlassFileOperater();

    /**
     * Get the Bluetooth file sending manager
     * @return IGlassFileOperate
     */
    IGlassFileOperate getGlassBtFileOperater();

    /**
      * Start sending H.264 video stream data
      * @param callback
      */
    void sendVideoStreamDataV2(IResultCallback callback);
}

IMessageListener

kotlin
interface IMessageListener {
    /**
     * Receive text messages
     * @param msg
     */
    void onTextMessage(String msg);

    /**
     * Receive audio data
     * @param buffer Audio data buffer
     */
    void onAudioStream(in byte[] buffer);

    /**
     * Receive binary data
     * @param device Bluetooth device that sent the data
     * @param tag Data tag
     * @param data Binary data
     */
    void onStreamDataReceived(String tag, in byte[] data);

}

IGlassFileOperate

java
interface IGlassFileOperate {
    /**
     * Send file
     * @param dir Custom file receiving directory, for example: "coustom" or "coustom/file/"
     * @param filePath (Note: the file must be placed in a public directory accessible from the SD card)
     * @param listener File sending listener
     * @param resultCallback Operation result callback
     */
    void  sendFile(String dir,String filePath, FileReceiveListener listener, IResultCallback resultCallback);

    /**
     * Stop sending file
     */
    void stopSendFile();

    /**
     * Whether a file is being sent
     * @return
     */
    boolean isSendingFile();

    /**
     * @Deprecated  message = "Deprecated in version V2.1.4; use setFileReceiveV2Listener", replaceWith = ReplaceWith("setFileReceiveV2Listener(listener)"),
     *  Set the local file receiving listener
     *  @param listener
     */
    void setFileReceiveListener(FileReceiveListener listener);

    /**
     *  @Deprecated  message = "Deprecated in version V2.1.4; use removeFileReceiveV2Listener", replaceWith = ReplaceWith("removeFileReceiveV2Listener(listener)"),
     * Remove the local file receiving listener
     *  @param listener
     */
    void removeFileReceiveListener(FileReceiveListener listener);

    /**
     *  Set the local file receiving listener
     *  @param listener
     */
    void setFileReceiveV2Listener(FileReceiveV2Listener listener);

    /**
     * Remove the local file receiving listener
     *  @param listener
     */
    void removeFileReceiveV2Listener(FileReceiveV2Listener listener);

    /**
     * Whether a file is being received
     */
    boolean isReceivingFile();

}

FileReceiveV2Listener

java
interface FileReceiveV2Listener {
    void onStart(String filePath);
    void onProgressChanged(String filePath, float progress);
    void onComplete(String filePath);
    void onFail();
    void onCancel(String filePath);
}

FileReceiveListener

java
interface FileReceiveListener {
    void onStart();
    void onProgressChanged(float progress);
    void onComplete(String filePath);
    void onFail();
    void onCancel();
}

6 File System Capabilities

IFileSystemService

kotlin
interface IFileSystemService {
    /**
      * Send a task to upload a file to the cloud
      * @param filePath File path
      * @param fileTag File tag type; see FileTag variables
      * @param lastModifiedTime File creation time
      * @param FileUploadListener File upload listener
      */
     void  sendUploadFileTask(String filePath, String fileTag, long lastModifiedTime, FileUploadListener listener);


     /**
     * Clear file upload task
     */
     void clearUploadTask();
}

FileUploadListener

java
interface FileUploadListener {

       /**Upload queued**/
       void onQueue(String filepath);
   /**
       *File server upload started,
      * */
      void onStart(String fileMd5);


      void onProgressChanged(float progress) ;


      void onComplete(String fileId, String fileUrl, String fileMd5);

      /**
       *Status update
       * */
      void onFail(String filepath,String fileMd5);

      /**
       *Progress update
       * */
      void onCancel(String fileMd5);

}

UploadStatus

java
interface UploadStatus {


    const int UPLOAD_STATUS_ING = 0;

      /**
       * Chinese
       */
    const int UPLOAD_STATUS_SUCCESS = 1;


     const int UPLOAD_STATUS_FAILED = -1;
}

7 Visual Recognition Capabilities

kotlin
    /**
     *  Get the online person/vehicle detection and recognition management service
     */
    @JvmStatic
    fun getGlassOnlineRecService(): IOnlineRecService? {
        return getService(ServerType.ONLINE_REC, IOnlineRecService::class.java)
    }

   GlassSdk.getGlassOnlineRecService()

IOnlineRecService

java
interface IOnlineRecService {
    /**
     * Start detection
     * @param mode Recognition mode (@AIRecgMode)
     */
    void startDetection(int mode);

    /**
     * Stop detection
     */
    void stopDetection();

    /**
     * Register listener
     * @param listener Detection listener
     */
    void setGlassOnlineRecListener(IGlassDetectionListener listener);

    /**
     * Remove listener
     * @param listener Detection listener
     */
    void removeGlassOnlineRecListener(IGlassDetectionListener listener);

    /**
     * Face recognition
     * @param param Face recognition parameters
     * @param callback Recognition result callback
     */
    void recognizeFace(in FaceRecognizeParam param, IResultCallback callback);

    /**
     * Get small face image
     * @param trackId
     * @param Bitmap
     */
    Bitmap getFaceSamllBitmap(long trackId);

    /**
     * Get small face image (rounded corners)
     * @param trackId
     * @param Bitmap
     */
    Bitmap getFaceRoundCornerSamllBitmap(long trackId);

    /**
     * Get small license plate image
     * @param plateNo
     * @param Bitmap
     */
    Bitmap getLprSamllBitmap(String plateNo);
}

IGlassDetectionListener

kotlin
interface IGlassDetectionListener {
    /**
     * Callback when detection mode changes
     * @param mode Detection mode
     */
    void onModeChange(int mode);

    /**
     * Face detection callback (can be used to update face tracking boxes)
     * @param faceModels Face model list
     */
    void onFaceTrack(in List<FaceModel> faceModels);

    /**
     * Filter the best face image (can be used for online face recognition interface calls)
     * @param processedFaceModels Processed face model list
     */
    void onProcessedFaceModels(in List<FaceModel> processedFaceModels);

    /**
     * License plate detection callback
     * @param lprModel License plate model
     */
    void onLPRTrack(in LPRModel lprModel);
}

IResultCallback

java
interface IResultCallback {

    void  onSuccess(in RecognizePersonInfo data);

    void onFailed(int code, String errormsg);
}

8 Connectivity: Classic Bluetooth

IBTService: Classic Bluetooth Service

kotlin
interface IBTService {

    /**
     * Get connected Bluetooth devices
     */
    List<BluetoothDevice> getConnectDevices();

    /**
     * Allow the device to be discoverable
     */
    void makeDeviceDiscoverable();

    /**
     * Set classic Bluetooth event callback
     */
    void setClassicBTListener(IClassicBTListener listener);

    /**
     * Remove classic Bluetooth event callback
     */
    void removeBlueToothServerListener(IClassicBTListener listener);

    /**
     * Get classic Bluetooth connection status
     */
    boolean isConnect();
}

IClassicBTListener

java
interface IClassicBTListener {
    /**
     * Callback when a classic Bluetooth device connects successfully
     * @param device Connected device information
     */
    void onClientConnected(in BluetoothDevice device);

    /**
     * Callback when a classic Bluetooth device connection is interrupted
     * @param device Interrupted device information
     */
    void onClientDisconnected(in BluetoothDevice device);

    /**
     * A connection was rejected
     * @param device Information about the device whose connection was rejected
     */
    void onConnectionRejected(in BluetoothDevice device);
}

9 Peripheral Capability: Bluetooth Ring

IBluetoothRingService: Bluetooth Ring Service

kotlin
interface IBluetoothRingService {
     /**
        * Set Bluetooth ring connection status callback
        * @param listener Callback instance
        */
       void setBluetoothRingState(IBluetoothRingConnectListener listener);

       /**
        * Check whether the ring is connected
        * @return Connection status
        */
       boolean isRingConnect();

       /**
        * Get the connected ring device
        * @return Bluetooth device instance
        */
       BluetoothDeviceBean getRingConnectDevice();

       /**
        * Release resources
        */
       void release();


}

IBluetoothRingConnectListener

java
interface IBluetoothRingConnectListener {

        /**
         * Ring connection status
         * @param BluetoothDeviceBean Bluetooth ring device information
         * @param connect Whether connected
         */
       void onConnect(in BluetoothDeviceBean bean, boolean connect);

}

10 Offline Recognition Capabilities

IOfflineRecServer: Offline Recognition Service

java
interface IOfflineRecServer {

    /**
     * Start recognition
     * @param sceneId Scene ID
     * @param mode Recognition mode(@AIRecgMode)
     * @param listener
     */
    void startRecognition(String sceneId, int mode,IGlassRecListener listener);

    /**
     * Stop recognition
     *  @param sceneId Scene ID
     *  @param listener
     */
    void stopRecognition(String sceneId,IGlassRecListener listener);

    /**
     * Check and update the person database
     *  @param sceneId Scene ID
     *  @param callback
     */
    void checkUpdateLibVersion(String sceneId, CheckUpdateCallback callback);

    /**
     * Check whether the person database for the scene exists
     * @param sceneId
     */
    boolean isExistLib(String sceneId);

    /**
     * Get person details
     * @param personnelId
     * @param callback Result callback
     */
    void getPersonnelInfo(String personnelId,ResultCallback callback);

    /**
     * Get small face image
     * @param frameId
     * @param Bitmap
     */
    Bitmap getFaceSamllBitmap(long frameId,long trackId);

    /**
     * Get small face image (rounded corners)
     * @param frameId
     * @param Bitmap
     */
    Bitmap getFaceRoundCornerSamllBitmap(long frameId,long trackId);

    /**
     * Report face recognition result
     * $param face: Face data
     */
    void submitRecognizedFaceInfo(in RecognizeFaceSubmitInfo info, in Bitmap face);
}

IOfflineFeatureRecService

kotlin
interface IOfflineFeatureRecService {
    /**
     * Add feature library
     * @param featureName Feature library name
     * @param featurePath Feature library file path
     */
    void addFaceFeatureFile(String featureName, String featurePath);

    /**
     * Remove feature library
     * @param featureName Feature library name
     */
    void removeFaceFeature(String featureName);

    /**
     * Start recognition
     * @param mode Recognition mode (@AIRecgMode)
     * @param listener Recognition result callback listener
     */
    void startRecognition(int mode, IGlassRecListener listener);

    /**
     * Stop recognition
     * @param listener Recognition result callback listener
     */
    void stopRecognition(IGlassRecListener listener);

    /**
     * Get small face image
     * @param frameId
     * @param Bitmap
     */
    Bitmap getFaceSamllBitmap(long frameId,long trackId);

    /**
     * Get small face image (rounded corners)
     * @param frameId
     * @param Bitmap
     */
    Bitmap getFaceRoundCornerSamllBitmap(long frameId,long trackId);

}

IGlassRecListener

java
interface IGlassRecListener {
    /**
     * Unified unique callback identifier method (implemented by the base class)
     */
    String getCallbackId();
    /**
     * Callback when detection mode changes
     * @param mode Recognition mode; value comes from AIRecgMode
     */
    void onModeChange(int mode);

    /**
     * Face detection callback
     * @param faceModels Face model list
     */
    void onFaceTrack(in List<FaceModel> faceModels);

    /**
     * License plate detection callback
     * @param lprModel License plate model
     */
    void onLPRTrack(in LPRModel lprModel);

    /**
     * Face recognition result callback
     * @param result Face recognition result
     */
    void onFaceRecognize(in FaceRecgResult result);


    /**
     * Face recognition result callback
     * @param result Face recognition result
     */
    void onFaceRecognizeNotInLib(in FaceRecgResult result);

    /**
     * Engine initialization callback
     */
    void onEngineInit();

}

11 Device and System Capabilities

IDeviceService: Device and System Service

kotlin
interface IDeviceService {

    String getDeviceName();

    String getSerialNumber();


    String getSystemVersion();

    DeviceStatusInfo getDeviceStatusInfo();


    /**
     * Switch mic beam (~3 s; keep UI responsive)
     * @param state
    0: Near-field directional — wearer only; suppress ambience
    1: Far-field directional — attenuate wearer; ±60° azimuth/el cone; range depends on SNR (~55 dB source @ 3 m in quiet rooms)
    3: Omnidirectional — capture from all directions, including wearer
     */
    fun switchMicScene(state: Int)
    void switchMicScene(int scene);


    void setVolume(int value);

    void setBrighing(int value);


    void reboot();


    void sendCusEvent(int eventCode,String extra);



    void setDeviceEventListener(DeviceEventListener listener);


    void setBatteryUpdateListener(BatteryUpdateListener listener);

    /**
     * Set system time
     * @param timestamp Timestamp
     */
    void setSystemTime(long timestamp);

    /**
     * Query all installed package information
     * @return Key-value pairs with package names as keys
     */
    Map<String, AppPackageInfo> queryAllPackages();



      /**
       * Set capture light
       * @param timestamp Timestamp
        */
     void setCameraLedEnable(boolean enable);



      /**
       * Set network access mode: 0 phone access; 1 glasses access
       * @param timestamp Timestamp
        */
     void setNetworkType(int type);



     int getNetworkType();


    /**
     * Configure app visibility and the display order of third-party apps
     * Used to batch configure the show/hide status of built-in system apps and third-party apps.
     *
     * @param appConfig App configuration information, including:
     *                  - appList: List of built-in system apps to hide
     *                  - thirdApps: Third-party app list, which will be displayed at the front
     * @param callback Set result callback; success=true indicates success, false indicates failure
     *
     */
     void configureAppVisibility(in  GlassAppConfig appConfig, IAppVisibilityListener callback);

    /**
     * Set the time synchronization server address
     * Supports HTTP/HTTPS and NTP protocols, and automatically identifies the protocol type based on the URL
     *
     * @param serverUrl Time server address, supporting the following formats:
     *                  - HTTP/HTTPS protocol: https://time.example.com or http://time.example.com
     *                  - NTP protocol: ntp.example.com or 192.168.1.100
     *                  - null or empty string: Use the default NTP protocol and public NTP servers
     *
     * @note If the URL starts with http:// or https://, HTTP is used to obtain the time
     *       Otherwise, NTP is used (standard UDP protocol, port 123)
     */
    void setTimeServer(String serverUrl);

    /**
     * Get the currently configured time server address
     *
     * @return Currently configured time server address; returns null if not configured
     */
    String getTimeServer();
}

IAppVisibilityListener

java
/**
 * App visibility setting callback interface
 */
interface IAppVisibilityListener {
    /**
     * Callback for setting app visibility
     * @param success true indicates success, false indicates failure
     */
    void onResult(boolean success);
}

DeviceEventListener

java
interface DeviceEventListener {
    void onDeviceEvent(int eventCode,String extra);


    void onCusEvent(int eventCode,String extra);
}

BatteryUpdateListener

java
interface BatteryUpdateListener {
    void onBatteryStatsuUpdate(int powrNumber,boolean charging);
}

12 ASR Speech-to-Text

IAsrService: ASR Speech-to-Text Service

java
interface IAsrService {

       /**
          *Start ASR task
          * @param callback Callback function returned by ASR
          */
         void startSpeech( SpeechCallback callback);

         /**
          *End ASR task
          */
         void stopSpeech();

}

SpeechCallback

java
interface SpeechCallback {
  /**
       * ASR recognition started
       */
      void onStart();
      /**
       * Intermediate ASR recognition result
       * @param content Recognized content
       */
      void onIntermediateVad(String content);

      /**
       * Final ASR recognition result
       * @param content Recognized content
       */
      void onAsrComplete(String content);

      /**
       * Exception callback
       * @param code Error code
       */
      void onError(int code);


      void onServiceConnectState(boolean connect);

      /**
       * Final ASR recognition result with intent recognition
       * @param content Recognized content
       * @param intent Intent enum
       * @param intentJson Intent JSON
       */
      void onAsrCompleteWithIntent(String content, int intent, String intentJson);
}